package cn.iocoder.yudao.module.blog.service.spacecomment;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.blog.controller.admin.spacecomment.vo.BlogSpaceCommentPageReqVO;
import cn.iocoder.yudao.module.blog.controller.app.space.commentvo.AppBlogSpaceCommentPageReqVO;
import cn.iocoder.yudao.module.blog.dal.dataobject.spacecomment.BlogSpaceCommentDO;
import cn.iocoder.yudao.module.blog.dal.mysql.spacecomment.BlogSpaceCommentMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;

/**
 * 动态评论 APP Service 实现类
 *
 * @author 曹建伟
 */
@Service
@Validated
public class AppBlogSpaceCommentServiceImpl implements AppBlogSpaceCommentService{

    @Resource
    private BlogSpaceCommentMapper blogSpaceCommentMapper;

    @Override
    public PageResult<BlogSpaceCommentDO> getSpaceCommentPage(AppBlogSpaceCommentPageReqVO pageReqVO) {
        return blogSpaceCommentMapper.appSelectPage(pageReqVO);
    }

    @Override
    public Long getTotalCount(Long spaceId){
        return blogSpaceCommentMapper.selectCount(BlogSpaceCommentDO::getSpaceId, spaceId);
    }
}
